<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/incube-app.tld" prefix="app" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<%!
	int id = 1;
	int iteracion = 1;
	int cantpordiv = 0; // Se inicializa en initVars

	public String initVars(String cant){
		id = 2;
		cantpordiv = Integer.parseInt(cant);
		iteracion = 1;
		return "";
	}
	
	public String getNextID(){
		return Integer.toString(id++);
	}
	public String getStyle(){
		if((id - 1) > 1)
			return "style=\"display:none\"";
		return "";
	}
	public String incrementarIterador(){
		iteracion += 1;
		return "";
	}

	public String getHeaderDIV(){
		if(iteracion >= cantpordiv ){
			if( (iteracion % cantpordiv) == 0)
				return "<div id=\"p" + getNextID()+ "\" " + getStyle() + ">";
			}
		return "";
	}
	
	public String getFooterDIV(){
		if(iteracion >= cantpordiv ){
			if( (iteracion % cantpordiv) == 0)
				return "</div>";
		}
		return "";
	}
%>



		<%=initVars((String)request.getParameter("cantporpage"))%>

		<jsp:useBean id="blanco" scope="page" class="java.lang.String" />
		
		<table border="0" cellpadding="5" cellspacing="0" height="100%" style="font-family:arial;font-size:8pt" width="100%">
		<tr>
			<td valign="top">
				<div id="p1" >
				<logic:iterate id="info" name="libros" type="org.fiel.domain.Informacion">
					<bean:define id="imagen" name="info" property="imagen" />
					<table>
						<tr>
							<td valign="top"> 
									<logic:notEmpty name="info" property="nameFile">
									<a href="/common/documentoIncrustado.jsp?documento=/publicaciones/Documentos/<%=info.getNameFile() %>" >
									</logic:notEmpty>
									<logic:notEmpty name="info" property="imagen">
									<img src="/imagenesLibros/<%=imagen%>">
									</logic:notEmpty>
									<logic:notEmpty name="info" property="nameFile">
									</a>
									</logic:notEmpty>
							</td>
							<td valign="top">
								<p style="text-align:justify">
										<logic:notEmpty name="info" property="nameFile">
										<a href="/common/documentoIncrustado.jsp?documento=/publicaciones/Documentos/<%=info.getNameFile() %>" >
										</logic:notEmpty>
										<span style="color:#fe9900;font-size:9pt;font-weight:bold" >
											<bean:write name="info" property="titulo" />
										</span>	<br>
										<logic:notEmpty name="info" property="nameFile">
										</a>
										</logic:notEmpty>
										<span style="color:#000000;font-size:8pt;font-weight:normal" >
											<bean:write name="info" property="abstract" />
										</span>
									<span style="color:#333399;font-size:9pt;font-weight:bold">
										<bean:write name="info" property="costo" />
									</span>
									<br>
								</p>
							</td>
						</tr>
					</table>		 
					<%=getFooterDIV()%>
					<%=getHeaderDIV()%>
					<%=incrementarIterador()%>
				</logic:iterate>
					</div>
			</td>
			<td width="5%" valign="bottom">
				<a href="javascript:scrollUp()"><img border="0" src="/images/scrollup.gif"></a>
				<a href="javascript:scrollDown()"><img border="0" src="/images/scrolldown.gif"></a>
			</td>
		</tr>
		</table>
